public class SalarySystemTest {
    public static void main(String[] args) {
        try {
            // 创建普通员工（测试异常：若workHours传350会抛出异常）
            Employee hourlyEmp = new HourlyEmployee("张三", "E001", 25, 160);
            // 创建管理人员
            Employee manager = new Manager("李四", "M001", 8000, 2000);

            // 多态体现：调用不同子类的calculateSalary
            System.out.println(hourlyEmp.generatePaySlip());
            System.out.println("------------------------");
            System.out.println(manager.generatePaySlip());

        } catch (Exception e) {
            System.out.println("错误信息：" + e.getMessage());
        }
    }
}